#ifndef _LXIANXI01_H_
#define _LIXANXI01_H_

#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>

#define NAME_LEN 32
#define PWD_LEN 32
#define PATH_NAME "./usr.info"


//用户节点
typedef struct UsrNode
{
    int iAge;
    char caUsrName[NAME_LEN];
    char caUsrPwd[PWD_LEN];
    struct UsrNode *pNext;
}UsrNode;
typedef struct UsrList
{
    int iLen;
    UsrNode *pFirstNode;
}UsrList;

//申请空间ok
UsrNode * mkUsrNode();
UsrList * mkUsrList();
//插入ok
void insert(UsrList *list,UsrNode *node);
//匹配ok
UsrNode *findUsrByName(const UsrList *list,const char *name);
//打印ok
void display(const UsrList *list);

//打开文件ok
FILE *openFile(const char *path,const char *mode);
//将用户列表保存到文件中ok
void saveUsrListToFile(const char *path,const UsrList *list);

//从文件读取用户信息并放到列表中ok
void loadUsrInfoFromFile(const char *path,UsrList *list);

//注册登录选择界面ok
int loginOrRegistFace();
//注册ok
void regist(UsrList *list);
//登录ok
UsrNode* login(UsrList *list);
//登录或注册存档ok
UsrNode* loginOrRegistOpe(UsrList* list);
//用户界面ok
int usrOpeFace();
//存档ok
void usrOpe(UsrList *list,UsrNode *node);
#endif